package cn.ac.jaas.isc.vegetable.common.gateway.exception;

import org.springframework.boot.diagnostics.AbstractFailureAnalyzer;
import org.springframework.boot.diagnostics.FailureAnalysis;

/**
 * @author 张高昌
 * @date 2022/3/16 16:53
 * @description 格式化异常信息，方便启动时观察。
 */
public class RouteCheckFailureAnalyzer extends AbstractFailureAnalyzer<RouteCheckException> {

    @Override
    protected FailureAnalysis analyze(Throwable rootFailure, RouteCheckException cause) {

        return new FailureAnalysis(cause.getMessage(), rootFailure.getMessage(), cause);
    }

}
